package com.zzf.fragmentbestpractice


//给String扩展一个函数
fun String.lettersCount():Int{
    var count = 0
    for (char in this){
        if (char.isLetter()){
            count ++
        }
    }
    return count
}

//通过扩展给String重载 乘法 运算符
//输出一个字符串的重复n倍的字符串
operator fun String.times(n:Int):String{
    val builder = StringBuilder()
    repeat(n){
        builder.append(this)
    }
    return builder.toString()
}
